Skip to content

Support processing XML comments on [AsParameters] parameter #63166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 11, 2025

Conversation

captainsafia
Copy link
Member

Closes #61936.

@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 00:08
@captainsafia captainsafia requested a review from a team as a code owner August 7, 2025 00:08
@github-actions github-actions bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Aug 7, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for processing XML comments on properties of [AsParameters] parameter classes in OpenAPI documentation generation. The feature enables XML documentation comments on individual properties within parameter classes to be reflected in the generated OpenAPI documentation.

Key Changes:

  • Added a new overload of CreateDocumentationId method to generate documentation IDs for properties using container type and property name
  • Enhanced the OpenAPI operation transformer to process parameter descriptions with property-level metadata and apply XML comments
  • Added comprehensive test cases covering various scenarios including mixed parameters, binding sources, and examples

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

File Description
OperationTests.MinimalApis.cs Added test cases for [AsParameters] with XML comments including parameter classes and validation scenarios
XmlCommentGenerator.Emitter.cs Added new CreateDocumentationId overload and logic to process property-level XML comments for AsParameters
Multiple snapshot files Updated generated code snapshots to include the new functionality and test data

@captainsafia captainsafia added feature-openapi area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Aug 7, 2025
{
if (operation.RequestBody is not null)
{
operation.RequestBody.Description = propertyComment.Summary ?? propertyComment.Description;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the right precedence? Just from the naming it looks like it should be the other way around.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you're right. I believe this should be .Value, .Returns then .Summary to match other property-based comments.

@captainsafia captainsafia force-pushed the safia/fix-asparams-xmldocs branch 2 times, most recently from da93209 to c4f153c Compare August 8, 2025 15:05
@captainsafia captainsafia force-pushed the safia/fix-asparams-xmldocs branch from c4f153c to a721dcb Compare August 11, 2025 17:11
@captainsafia captainsafia enabled auto-merge (squash) August 11, 2025 17:34
@captainsafia captainsafia merged commit a7e8fa4 into main Aug 11, 2025
29 checks passed
@captainsafia captainsafia deleted the safia/fix-asparams-xmldocs branch August 11, 2025 18:23
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-rc1 milestone Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-openapi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XML Doc comments on properties of an AsParameters class aren't included in the generated OpenAPI doc
3 participants